package sanglh.edu.hsphysics;

import java.io.File;

import sanglh.edu.hsphysics.utils.DeviceUtils;
import sanglh.edu.hsphysics.utils.FileUtil;
import sanglh.edu.hsphysics.utils.SharePreferenceUtils;
import android.content.Context;
import android.net.Uri;
import android.os.Build;

public class CONFIG {
	private static final String IMAGE_FOLDER_NAME = "HSPhysic";
	private static final String PRE_IS_SHOW_GUIDE = "PRE_IS_SHOW_GUIDE";

	public static boolean isShowGuide(Context context) {
		return SharePreferenceUtils.getPrefBoolean(context, PRE_IS_SHOW_GUIDE,
				false);
	}

	public static void setShowGuide(Context context) {
		SharePreferenceUtils.putPrefBoolean(context, PRE_IS_SHOW_GUIDE, true);
	}

	public static Uri createImageUri(Context context) {
		File folder = FileUtil.getExternalDirectory(context, IMAGE_FOLDER_NAME);
		String fileName = FileUtil.createTimeStamp();
		File file = new File(folder, String.format("%s_%s.jpg",
				DeviceUtils.getUID(context), fileName));
		return Uri.fromFile(file);
	}

	public static File getImageFolder(Context context) {
		return FileUtil.getExternalDirectory(context, IMAGE_FOLDER_NAME);
	}

	public static void deleteImageFolder(Context context) {
		File folder = FileUtil.getExternalDirectory(context, IMAGE_FOLDER_NAME);

		FileUtil.delete(folder);
	}
}
